#ifndef BIT_WIN_DELEGATE_H
#define BIT_WIN_DELEGATE_H


#include <QItemDelegate>


namespace BitWin
{


// Delegate for drawing bitwise data in table view
// (see Qt Model-View Framework documentation).
class Delegate: public QItemDelegate
{
    Q_OBJECT

    // Auxiliary methods

    void paintLeftBound(
        QPainter* painter,
        const QStyleOptionViewItem& option
    ) const;

    void paintBitwise(
        QPainter* painter,
        const QStyleOptionViewItem& option,
        const QVariant& data
    ) const;

public:

    Delegate(QObject* parent=0);

    // Key method: overrides inherited method
    // called by the framework to paint table item.
    virtual void paint(
        QPainter* painter,
        const QStyleOptionViewItem& option,
        const QModelIndex& index
    ) const;
};


} // BitWin namespace end


#endif
